#include <vector>
#include <string>


using namespace std;


class Solution {
public:
	string  mm[4][11] = {
		{"","I","II","III","IV","V","VI","VII","VIII","IX" },
		{"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"},
		{"","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"},
		{"","M","MM","MMM"}
	};
	string intToRoman(int num) {
		string ans;
		string rc[100]; int idx = 0;
		int pos = 0;
		while (num != 0) {
			int curr = num % 10;
			if (curr != 0) {
				rc[idx] = mm[pos][curr];
				idx++;
			}
			pos++;
			num = num / 10;
		}
		idx--;
		while (idx >= 0) {
			ans += rc[idx];
			idx--;
		}

		return ans;
	}
};


//int main() {
//	Solution s;
//	s.intToRoman(3);
//
//}